<template>
  <div class="warn-group">
    <set-group :col-set="colSet" ref="groupRef"></set-group>
  </div>
  <div class="btn-list flex-center">
    <BtnGroup close-name="还原" submit-name="保存" @close="getData" @submit="save"></BtnGroup>
  </div>
</template>

<script setup>
import {colSet} from "./data";
import {ref} from "@vue/reactivity";
import {onMounted} from "@vue/runtime-core";
import {JcszApi, JcszPostApi, JkzbApi, JkzbEditApi} from "@/common/customs/overview";
import BtnGroup from "@/components/customs/btn-group";
import {message} from "ant-design-vue";
import SetGroup from "@/components/customs/set-group/index.vue"

const timeData = ref({});
const groupRef = ref();

const getData = async () => {
  const api = new JkzbApi();
  await api.send();
  const {data} = await api.getDatas();
  groupRef.value.timeData = data
};
const save = async () => {
  timeData.value = groupRef.value.timeData
  const api = new JkzbEditApi();
  api.data(timeData.value);
  await api.send();
  const {msg, code} = await api.getDatas();
  if (code === 0) {
    message.success("保存成功");
  } else {
    message.error(msg);
  }
};
onMounted(() => {
  getData();
});
</script>

<style lang="less" scoped>
@import "./index.less";
</style>
